package newsSystem.news;

import newsSystem.dao.NewsInfoJDBC;

import java.util.List;

public class NewsPage {
    private static List<NewsInfo> NewsList;
    public static void main(String[] args) throws Exception {
//        调用NewsJDBC方法
        NewsInfoJDBC.newsJDBC();
//        调用AdminManager的get来测试添加函数,获取管理员数据
        getNewsList();

    }
    public static void getNewsList(){
        NewsList= NewsManager.getNewsList();
        // 遍历管理员集合
        for (NewsInfo news : NewsList) {
            System.out.println("NewsID: " +news.getNewsID()+ ", NewsName: " +news.getNewsName()+", NewsPublish: " +news.getNewsPublish()+ ", MPrice: " +news.getMPrice()+",NewsContent:"+news.getNewsContent()+",NewsData:"+news.getNewsData()+", NewsCNo: " +news.getNewsCNo()+",newsImage:"+news.getNewsImage()+",newsDept:"+news.getNewsDept());
        }

    }

    // 通过构造函数传递 NewsList
    public NewsPage(List<NewsInfo> NewsList) {
        this.NewsList = NewsList;
    }

    // 或者通过方法传递 NewsList
    public void setNewsList(List<NewsInfo> NewsList) {
        this.NewsList = NewsList;
    }
}